import {getTrade, getOrders, getPayInfo, getBaseCategoryList} from "http";
export default {
    state:{
        tradeInfo:{},
        orderList:{},
        payInfo:{}
    },
    mutations:{
        getTrade(state,tradeInfo){state.tradeInfo=tradeInfo},
        getOrders(state,orderList){state.orderList=orderList},
        getPayInfo(state,payInfo){state.payInfo=payInfo}
    },
    actions:{
        async getTrade({commit}){
            const {code,data} =  await getTrade();
            if(code === 200){
                commit("getTrade",data)
            }
        },
        async getOrders({commit},{page,limit}){
            const {code,data} =  await getOrders(page,limit);
            if(code === 200){
                commit("getOrders",data)
            }
        },
        async getPayInfo({commit},orderId){
            const {code,data} =  await getPayInfo(orderId);
            if(code === 200){
                commit("getPayInfo",data)
            }
        }
    }
}
